#pragma comment(lib, "OpenGL32.lib")
#pragma comment(lib, "Glu32.lib")
#include <GL/GLU.h>
#include <GL/GL.h>


#include <irrlicht.h>
using namespace irr;

#pragma comment(lib, "Irrlicht.lib")

#include "TGAWriter.h"

// rounds a number up to the closest power of 2
s32 roundup(s32 x)
{
    s32 i=1;
    while (i<x)
      i*=2;
    return i;
}


class CBillboardTools
{
public:
    CBillboardTools() : 
                      device(0), driver(0), smgr(0), node(0), cam(0),
                      bgcol(0,255,0,255),
                      imagesx(16), imagesy(1),
                      bitmapwidth(1024), bitmapheight(128)
                      
    {
                                         
        device = createDevice( video::EDT_OPENGL, core::dimension2d<s32>(800, 600), 
                               32, false, false, false);

        driver = device->getVideoDriver();
        smgr = device->getSceneManager();
        
        cam = smgr->addCameraSceneNode();
        cam->setTarget(core::vector3df(0,0,300));
        
        // create GUI
        
        
        // make bitmap data
        setOutputSize(1024,128);
    }
    
    // runs the main loop until exit
    void run();
    
    // creates a row
    void makeRow(s32 row);
    
    // creates bitmap data in ram
    bool setOutputSize(s32 x, s32 y)
    {
         
         roundup(x);
         roundup(y);
    }
      
private:
    void createGUI();
    
    IrrlichtDevice *device;
    video::IVideoDriver* driver;
    scene::ISceneManager* smgr;
    scene::IAnimatedMeshSceneNode* node;
    scene::ICameraSceneNode *cam;
    
    video::SColor bgcol;
    
    s32 imagesx, imagesy;
    
    // output bitmap info
    s32 bitmapwidth, bitmapheight, channels;
      
};
